﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace Common.Background
{
    /// <summary>
    /// 树结果接口
    /// </summary>
    public interface ITree
    {
        /// <summary>
        /// 主键
        /// </summary>
        int ID { get; }
        /// <summary>
        /// 父ID
        /// </summary>
        int? ParentID { get; }
        /// <summary>
        /// 名称
        /// </summary>
        string Name { get; }
        /// <summary>
        /// 级别，树的根为0
        /// </summary>
        int Level { get; }
    }

    /// <summary>
    /// 树结果接口,对泛型的支持
    /// </summary>
    public interface ITree<T> : ITree
    {
        /// <summary>
        /// 父级对象
        /// </summary>
        T Father { get; set; }
        /// <summary>
        /// 子孙对象
        /// </summary>
        IEnumerable<T> Sons { get; set; }
    }
}